using UnityEngine;

[RequireComponent(typeof(UVOffsetTracker))]
[ExecuteInEditMode]
public class UVOffsetAnimator : MonoBehaviour
{
	private int _lastIndex;

	public float Index;

	private bool _isUseUV2;

	public bool IsUseUV2;

	private UVOffsetTracker _tracker;

	private void Start()
	{
		_tracker = GetComponent<UVOffsetTracker>();
	}

	private void Update()
	{
		int num = Mathf.RoundToInt(Index);
		if (num != _lastIndex || _isUseUV2 != IsUseUV2)
		{
			_lastIndex = num;
			_isUseUV2 = IsUseUV2;
			_tracker.SetIndex(_lastIndex, _isUseUV2);
		}
	}
}
